<?php
namespace App\Socket\Model;
use think\Model;
class Room extends Model {
    protected $pk="rid";    
    protected $append=["Users"];
    protected $type=[
        "point"=>"json",
        "outCard"=>"json",
        "baseCard"=>"json",
        "handCard"=>"json",
        "ready"=>"json",
        "score"=>"json"
    ];    
    public $User=[];
    
    public function getUsersAttr(){                    
        $point = $this->point;         
        $this->User = User::where("uid","in",$point)->select();                                                    
        return $this->User;
    }

    public function getUser($uid){
        foreach($this->Users as $item){
            if($item->uid==$uid){
                return $item;
            }
        }
    }
}
